# -*- coding:utf-8 -*-
"""Created By Corvo"""

import weakref

from base import LogicBlockUIBase


class LogicRpcDoubleBlockUI(LogicBlockUIBase):
    """逻辑双端方块界面"""
    __mVersion__ = 1

    def __init__(self, namespace, name, param):
        super(LogicRpcDoubleBlockUI, self).__init__(namespace, name, param)
        self.logic_block = weakref.proxy(param["logic_block"])
        self._recall = param["recall"]

    def OnDestroy(self):
        del self.logic_block
        super(LogicRpcDoubleBlockUI, self).OnDestroy()

    def Create(self):
        super(LogicRpcDoubleBlockUI, self).Create()
        self._recall(self)
        del self._recall

    # -----------------------------------------------------------------------------------

    @property
    def block(self):
        return self.logic_block

    # -----------------------------------------------------------------------------------

    def SetExitUI(self):
        super(LogicRpcDoubleBlockUI, self).SetExitUI()
        self.block.OnUISetExit()
